<%--
  Created by IntelliJ IDEA.
  User: chenrui
  Date: 2021/4/16
  Time: 14:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<script>
    function del(id) {
        if(window.confirm("您确定要删除该数据吗？")) {
            location.href = "del?id=" + id;
        }
    }
</script>
<h2>通讯录列表</h2>
<a href="add">添加</a>
<table width="100%" border="1">
    <tr>
        <td>姓名</td>
        <td>手机号</td>
        <td>性别</td>
        <td>家庭住址</td>
        <td>编辑</td>
    </tr>
    <c:forEach items="${list}" var="address">
        <tr>
            <td>${address.username}</td>
            <td>${address.phone}</td>
            <td>${address.gender}</td>
            <td>${address.address}</td>
            <td><a href="edit?id=${address.id}">修改</a> <a href="javascript:del(${address.id})">删除</a></td>
        </tr>
    </c:forEach>
</table>
</body>
</html>
